1. /* scfclog.cpp by K.Tsuru */
  2. // function ID = 9108
  3. /*************************************************
  4. SComplex class log(z)
  5. Let z = x+i*y = |z|*exp{i*arg(z)}.
  6. It returns log(x+i*y) = log(|z|)+i*arg(z).
  7. The evaluation of |z| calls the square root routine,
  8. then a formula
  9. log(|z|) = (1/2)*log(x*x+y*y)
  10. is used.
  11. **************************************************/
  12. #ifndef SN_H
  13. #include "sn.h"
  14. #endif
  15. SComplex Clog(const SComplex& z){
  16. SDouble r = z.Norm(); // r = x*x+y*y
  17. if(r.Sign() == 0) r.SetError(r.DOMAIN_ERR, "Clog z=0", 9108);// z = 0
  18. r = Log(r)/2.0; // r = log |z|
  19. return SComplex(r, Arg(z));
  20. }

scfclog.cpp : last modifiled at 2015/06/22 15:15:56(629 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).